<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><html>
<head>
    <title>百度一下，你就知道</title>
    <style type="text/css">
        body{
            height:100%;
            width:100%;
            margin:0;
            padding:0;
        }

        .menu{
            text-align:right;
        }

        a{
            text-decoration:none;
        }

        .middle{
            text-align:center;
            width:100%;
            height:100px;
            margin-top:130px;
        }

        .input{
            border: 1px solid #b6b6b6;
            width:474px;
            height:36px;
            font-size:20px;
        }
        .img{
            border:0;
            height:140px;
            float: none;
        }
        .submit{
            background-color:#3385ff;
            height:38px;
            font-size:20px;
            color:white;
            border:0
        }
    </style>
    <meta charset="UTF-8">
    <script>
        let hyperlinks = null
        let index = 0
        let length = 0
        let default_hyperlink = "https://imusae-download.90sheji.com/imusae/download/2021/03/10/7b490920c1d3e28745a5d72c5dde299e.png?sign=87dc63b4a490011aa492859b51284616&t=61042200&imageMogr2/thumbnail/804x/crop/!x800-0a0/auto-orient/interlace/1/sharpen/1/quality/85/format/webp"
        function showPredictingOutcomes(str) {
            let xmlhttp;
            if (str==="")
            {
                document.getElementById("predictingOutcomes").innerText="显示预测结果";
                return;
            }
            if (window.XMLHttpRequest)
            {
                // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlhttp=new XMLHttpRequest();
            }
            else
            {
                // IE6, IE5 浏览器执行代码
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function ()
            {
                if (xmlhttp.readyState===4 && xmlhttp.status===200)
                {
                    let json = JSON.parse(xmlhttp.responseText);
                    document.getElementById("predictingOutcomes").innerHTML=json.words;
                    hyperlinks = JSON.parse(json.hyperlinks.replaceAll("\\", ''))
                    length = hyperlinks.length
                    index = 0
                    haha() // 调用
                }
            }
            xmlhttp.open("GET", "/SelectMySQL?word="+str, true);
            xmlhttp.send();
        }
        function haha() {
            if (hyperlinks != null) {
                if (hyperlinks[index] != null) {
                    document.getElementById("hyperlink-img").setAttribute("src", hyperlinks[index])
                    document.getElementById("hyperlink-img-a").setAttribute("href", hyperlinks[index])
                } else {
                    default_hy()
                }
            } else {
                default_hy()
            }

            index = (index+1)%length
        }
        onload=function() {
            default_hy()
            setInterval(haha, 1000)
        }
        function default_hy() {
            document.getElementById("hyperlink-img").setAttribute("src", default_hyperlink)
            document.getElementById("hyperlink-img-a").setAttribute("href", default_hyperlink)
        }
    </script>
</head>
<body>
<div style="text-align:right;">
    <div class="menu">
        <a href="http://www.nuomi.com/?cid=002540">糯米</a>
        <a href="http://news.baidu.com">新闻</a>
        <a href="http://www.hao123.com">hao123</a>
        <a href="http://map.baidu.com">地图</a>
        <a href="http://v.baidu.com">视频</a>
        <a href="http://tieba.baidu.com">贴吧</a>
        <a href="https://passport.baidu.com/v2/?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2F">登录</a>
        <a href="http://www.baidu.com/gaoji/preferences.html">设置</a>
        <a href="http://www.baidu.com/more/">更多产品</a>
    </div>
</div>

<div class="middle">
    <form>
        <a href="https://www.baidu.com/" target="_blank">
            <img src="https://www.baidu.com/img/bd_logo1.png" alt="Baidu" class="img">
        </a>
        <br>
        <label for="input"></label><input type="text" autofocus="autofocus" class="input" name="word" id="input" onkeyup="showPredictingOutcomes(this.value)">
        <input type="submit" value="百度一下" class="submit" href="https://www.baidu.com/" >
        <div id="predictingOutcomes">显示预测结果</div>
        <br/>
        <div id="image-append">
            <a id="hyperlink-img-a" target="_blank">
                <img id="hyperlink-img" class="img" src="" alt="photo">
            </a>
        </div>
    </form>
</div>
<div style="text-align:center; bottom:0;margin-top:300px;">
    <div>
        <a target="blank">把百度设为主页</a>
        <a href="http://home.baidu.com">关于百度</a>
        <a href="http://ir.baidu.com">About&nbsp;&nbsp;Baidu</a>
        <a href="http://e.baidu.com/?refer=888">百度推广</a>
        <p>©2016&nbsp;Baidu&nbsp;<a href="http://www.baidu.com/duty/">使用百度前必读</a>&nbsp;<a href="http://jianyi.baidu.com/">意见反馈</a>&nbsp;京ICP证030173号&nbsp;</p>
        <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11000002000001" target="_blank">京公网安备11000002000001号</a>
    </div>
</div>
</body>
</html>
